package com.zadtek.sharkRider.activity.adapter;

import java.util.List;

import android.annotation.SuppressLint;
import android.content.Context;
import android.widget.TextView;

import com.zadtek.sharkRider.R;
import com.zadtek.sharkRider.activity.common.Const;
import com.zadtek.sharkRider.activity.data.UserDetailsData;

public class UserDetailsAdapter extends CommonAdapter<UserDetailsData> {

	public UserDetailsAdapter(Context context, List<UserDetailsData> datas,
			int layoutId) {
		super(context, datas, layoutId);
		// TODO Auto-generated constructor stub
	}

	@SuppressLint("ResourceAsColor")
	@Override
	public void convert(ViewHolders holder, UserDetailsData t) {
		TextView details_name = holder.getView(R.id.details_name);
		TextView details_number = holder.getView(R.id.details_number);
		TextView details_time = holder.getView(R.id.details_time);
		if (t != null) {
			if (Const.DETAIL_INDEX == 0) {
				details_name.setText(t.getMark());
			} else {
				details_name.setText("提现");
			}

			String preMoney = "";
			String amount = t.getAmount();
			if (amount.contains("-")) {
				details_number.setTextColor(mContext.getResources().getColor(
						R.color.detail_number1));
			} else {
				if (Const.DETAIL_INDEX == 1) {//提现记录
					preMoney = "-";
				} else {
					preMoney = "+";
				}
				details_number.setTextColor(mContext.getResources().getColor(
						R.color.detail_number));
			}
			details_number.setText(preMoney + amount);
			details_time.setText(t.getCreat_time());

		}
	}

}
